//
// Created by hamlet on 2022/2/5.
//

#ifndef TIANQI_SETTINGSWIDGET_H
#define TIANQI_SETTINGSWIDGET_H

#include <QWidget>
#include "tianqidata.h"

class TianqiAccesser;

QT_BEGIN_NAMESPACE
namespace Ui { class SettingsWidget; }
class QNetworkAccessManager;
class QNetworkReply;
class QTableWidgetItem;
QT_END_NAMESPACE

class SettingsWidget : public QWidget {
Q_OBJECT

public:
    explicit SettingsWidget(QWidget *parent = nullptr);
    void injectTianqiAccesser(TianqiAccesser *accesser);
    ~SettingsWidget() override;

signals:
    void sign_returnPageMain();

public slots:
    void reVisibleUI();
    void OK();
    void Cancel();

private slots:
    void requestLocations();
    void searchLocations(QNetworkReply *reply);
    void writeLocation(int row, int column);

private:
    Ui::SettingsWidget *ui;
    QNetworkAccessManager *m_manager;

    void readData();

    // inject
    TianqiAccesser *m_tianqiAccesser;
};

#endif //TIANQI_SETTINGSWIDGET_H
